@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfig.class)
public class TransactionTest {
    
    @Autowired
    private UserService userService;

    @Test(expected = IllegalArgumentException.class)
    public void testTransactionRollback() {
    
        userService.transferMoney("Alice", "Bob", new BigDecimal("-100"));
      
    }

    @Test
    public void testTransactionCommit() {
      
        userService.transferMoney("Alice", "Bob", new BigDecimal("100"));
        // 验证数据是否更新
    }
}